<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../back-common.jsp"%>
<%@ include file="/WEB-INF/pages/common/jquery2.1.4.jsp"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<link href="<ls:templateResource item='/resources/plugins/select2-4.0/select2.css'/>" rel="stylesheet"/>
<script src="<ls:templateResource item='/resources/plugins/select2-4.0/select2.full.min.js'/>" type="text/javascript"></script>
<script src="<ls:templateResource item='/resources/plugins/select2-4.0/i18n/zh-CN.js'/>" type="text/javascript"></script>
<script src="<ls:templateResource item='/resources/plugins/select2-4.0/makeSelect2.js'/>" type="text/javascript"></script>

	<table class="${tableclass}" style="width: 100%">
	   <tr><th><strong class="am-text-primary am-text-lg"> 项目管理</strong> /  模块管理 - ${project.name}
	    	</th></tr>
	</table>    
  <div style="margin-left: 0.5rem">
    <div class="seller_list_title">
        <ul class="seller_title_ul am-tabs-nav am-nav am-nav-tabs">
            <li><i></i><a href="<ls:url address="/admin/project/load/${project.id}"/>">项目信息</a></li>
            <li class="am-active"><i></i><a href="<ls:url address="/admin/projectPlan/query/${project.id}"/>">里程碑</a></li>
            <li><i></i><a href="<ls:url address="/admin/task/query/${project.id}"/>">目标</a></li>
            <li><i></i><a href="<ls:url address="/admin/projectModule/query/${project.id}"/>">模块</a></li>
            <li><i></i><a href="<ls:url address="/admin/projectMember/query/${project.id}"/>">团队</a></li>
            <li><i></i><a href="<ls:url address="/admin/projectReport/query/${project.id}"/>">报表</a></li>
        </ul>
    </div>
</div>  
    
    <form action="<ls:url address='/admin/projectPlan/query/${projectId}'/>" id="form1" method="post">
        <table class="${tableclass}" style="width: 100%">
		    <tbody><tr><td>
		    	    <div align="left" style="padding: 3px">
				       	    <input type="hidden" id="curPageNO" name="curPageNO" value="${curPageNO}" />
				       	    <select class="combox ${selectclass}" id="moduleId" name="moduleId" requiredTitle="--选择模块--" showNone="false" selectedValue="${projectPlanQueryDto.moduleId}" retUrl="${contextPath}/admin/project/common/loadModules/${project.id}">
				       	    </select>
				            &nbsp;内容:
				            <input type="text" name="title" maxlength="50" value="${projectPlanQueryDto.title}" />
				            &nbsp;	
				  <select name="userName" id="userName" style="width: 120px">
				   	<c:if test="${not empty projectPlanQueryDto.userName}">
				   	  <option value="${projectPlanQueryDto.userName}">${userRealName}</option>
				   	</c:if>
				   </select>
				   
				   	<select id="status" name="status" style="height: 30px">
					        <ls:optionGroup type="select" required="false" defaultDisp="--选择状态--" cache="true" beanName="PROJECT_STATUS" selectedValue="${projectPlanQueryDto.status}" />
					</select>	
				            <input type="submit" class="criteria-btn" value="搜索"/>
				            <input type="button"  class="criteria-btn" value="创建" onclick='javascript:updateProjectPlan(this)'/>
				      </div>
		     </td></tr></tbody>
	    </table>
    </form>
         <div align="center"> 
          <%@ include file="/WEB-INF/pages/common/messages.jsp"%>
		<display:table name="list" requestURI="/admin/projectPlan/query/${projectPlanQueryDto.projectId}" id="item" export="false" sort="external" class="${tableclass}" style="width:100%">
     		<display:column title="ID" property="id"></display:column>
     		<display:column title="模块" property="moduleName" sortable="true" sortName="pm.module_id"></display:column>
     		<display:column title="内容" style="min-width:300px"><font color="${item.color}">${item.title}</font></display:column>
     		<display:column title="开始时间" style="min-width:100px" sortable="true" sortName="pm.start_date"><fmt:formatDate value="${item.startDate}" pattern="yyyy-MM-dd" /></display:column>
	        <display:column title="结束时间" style="min-width:100px" sortable="true" sortName="pm.end_date"><fmt:formatDate value="${item.endDate}" pattern="yyyy-MM-dd" /></display:column>
	        <display:column title="资源" property="userRealName" style="min-width:100px"></display:column>
	        <display:column title="状态" style="min-width:80px;width:80px">
	        	<ls:optionGroup type="label" required="false" defaultDisp="" cache="true"  beanName="PROJECT_STATUS" selectedValue="${item.status}"/>
	        </display:column>
	     <display:column title="操作" media="html" style="width:235px;min-width:235px">
	      	<div class="am-btn-toolbar">
			  <div class="am-btn-group am-btn-group-xs">
				    <button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="window.location.href='${contextPath}/admin/task/loadByProject/${project.id}?planId=${item.id}'"><span class="am-icon-pencil-square-o"></span> 新增目标</button>
					<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="javascript:editProjectPlan(this,'${item.id}')"><span class="am-icon-pencil-square-o"></span> 修改</button>
					<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="deleteById('${item.id}')" ><span class="am-icon-trash-o"></span> 删除</button>
			  </div>
			</div>
	      </display:column>
	      
	      
	    </display:table>
	       <ls:page pageSize="${pageSize }"  total="${total}" curPageNO="${curPageNO }"  type="default"/> 
	    </div>
     
        <script language="JavaScript" type="text/javascript">
		  $(document).ready(function() {
				 //三级联动
		     	 $("select.combox").initSelect();
		     	 makeSelect2(contextPath + "/admin/adminUser/userListInTeam/${project.id}","#userName","指派给","value","key");
		  });
        
			   function deleteById(id) {
			      if(confirm("  确定删除 ?")){
			            window.location = "<ls:url address='/admin/projectPlan/delete/" + id + "'/>";
			        }
			    }
			
			   function pager(curPageNO){
			            document.getElementById("curPageNO").value=curPageNO;
			            document.getElementById("form1").submit();
			        }
			        
			   	 //新增项目计划
			    function updateProjectPlan(obj, projectModuleId){
			    		var page = contextPath + "/admin/projectPlan/loadByProject/${project.id}";
			    		layer.open({
				    		  type: 2,
				    		  id: "updateProjectPlan",
				    		  title: "新增里程碑",
				    		  area: ['800px'],
				    		  content: page, //iframe的url，no代表不显示滚动条
				    		  success: function(layero, index) {
				    		        layer.iframeAuto(index);
				    		        layer.style(index, {
				    		        	  top: '60px'
				    		        	}); 
				    		    }
				    		});
			    	}
			   	 
			   	 //修改产品模块
			    function editProjectPlan(obj, projectPlanId){
			    		var page = contextPath + "/admin/projectPlan/load/" + projectPlanId;
			    		layer.open({
				    		  type: 2,
				    		  id: "updateProjectPlan",
				    		  title: "编辑里程碑",
				    		  area: ['800px'],
				    		  content: page, //iframe的url，no代表不显示滚动条
				    		  success: function(layero, index) {
				    		        layer.iframeAuto(index);
				    		        layer.style(index, {
				    		        	  top: '60px'
				    		        	}); 
				    		    }
				    		});
			    	}
		</script>


